// 接口定义 对象结构
interface NameInfo{
    firstName:string,
    lastName:string
}

const getFullName = ({firstName,lastName}:NameInfo):string =>{
    return `${firstName}-${lastName}`;
}

// tslint:disable-next-line: no-console
// console.log(getFullName({firstName:'xulong',lastName:'wang'}));

// 接口定义 函数结构

// 类型别名
type AddFunc = (a:number,b:number) =>number

const add:AddFunc = (n1,n2) => n1 + n2;

// tslint:disable-next-line: no-console
console.info(add(1,1));


// 索引类型
// interface RoleDic {
//     [id:number]:string
// }

// const role1:RoleDic = {
//     0:"admin"
// }

interface RoleDic{
    [id:string]:string
}
const role2:RoleDic = {
    1:"admin",
    "a":"superadmin "
}

interface Counter{
    ():void,
    count:number;
}

const getCounter = ():Counter =>{
    const c = ()=>{
        c.count ++
    }
    c.count = 0
    return c;
}











